using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace TimeWar
{
    namespace Octree
    {

        public interface IOctree<T>
        {
            /// <summary> Add a object into the organizer at a location.</summary>
            /// <param name="x">up-down location x/y/z</param>
            /// <param name="y">left-right location x/y/z</param>
            /// <param name="z">front-back location x/y/z</param>
            /// <returns> true if the insertion worked. </returns>
            bool AddNode(Vector3 vector, T obj);

            /// <summary> Remove a object out of the organizer at a location.</summary>
            /// <param name="x">up-down location (x, y)</param>
            /// <param name="y">left-right location (y, x)</param>
            /// <returns> the object removed, null if the object not found.</returns>
            T RemoveNode(Vector3 vector, T obj);

            /// <summary>Clear the octree.</summary>
            void Clear();

            /// <summary> Find an object closest to point x/y/z.</summary>
            /// <param name="x">up-down location in Octree grid</param>
            /// <param name="y">left-right location in Octree grid</param>
            /// <param name="z">front-back location in Octree grid</param>
            /// <returns> the object that is closest to point x/y/z.</returns>
            T GetNode(Vector3 vector);

            /// <summary> Find an object closest to point x/y/z within a distance.</summary>
            /// <param name="x">up-down location in Octree grid</param>
            /// <param name="y">left-right location in Octree grid</param>
            /// <param name="z">front-back location in Octree grid</param>
            /// <param name="withinDistance">maximum distance to have a hit.</param>
            /// <returns> the object that is closest to the x/y/z, within the given distance.</returns>
            T GetNode(Vector3 vector, double withinDistance);

            /// <summary> Find an set of objects closest to point x/y/z within a given radius.</summary>
            /// <param name="x">up-down location in Octree grid</param>
            /// <param name="y">left-right location in Octree grid</param>
            /// <param name="z">front-back location in Octree grid</param>
            /// <param name="radius">search radius</param>
            /// <returns> the object that is closest to point x/y/z, within the given distance.</returns>
            List<T> GetNodes(Vector3 vector, double radius);

            List<T> GetNodes(Vector3 vector, double MinRadius, double MaxRadius);

            // <summary> Find an object closest to point x/y/z, within a cube.</summary>
            List<T> GetNode(float xMax, float xMin, float yMax, float yMin, float zMax, float zMin);

        }
    }

}